﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Demonstartor
{
    class FlightAbnormalitiesList: List<FlightAbnormality>
    {
        public FlightAbnormalitiesList()
            : base()
        {

        }

        public DataTable GetDataTable()
        {
            DataTable Res = new DataTable();

            Res.Columns.Add("Имя");
            Res.Columns.Add("Описание");
            Res.Columns.Add("Дата начала");
            Res.Columns.Add("Дата конца");

            for (int i = 0; i < Count; i++)
            {
                DataRow R = Res.NewRow();
                R[0] = this[i].Name;
                R[1] = this[i].Description;
                R[2] = this[i].StartDateTime.ToString("HH:mm:ss");
                R[3] = this[i].StopDateTime.ToString("HH:mm:ss");
                Res.Rows.Add(R);
            }

            return Res;
        }
    }
}
